﻿@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Index.cshtml";
}
<script>

    $(function () {
        gridList();
    })
    function gridList() {
        var $gridList = $("#gridList");
        $gridList.dataGrid({
            url: "/Project/Instructions/GetGridJsonC",
            height: $(window).height() - 96,
            colModel: [
                { label: "主键", name: "F_Id", hidden: true, key: true },
                { label: '标题', name: 'Title', width: 380, align: 'center' },
                {
                    label: '添加时间', name: 'F_CreatorTime', width: 120, align: 'center',
                    formatter: "date", formatoptions: { srcformat: 'y-m-d h:i:s', newformat: 'y-m-d h:i:s' }
                },
                {label: '添加人', name: 'AddUserName', width: 120, align: 'center'}
            ],
            pager: "#gridPager",
            sortname: 'F_CreatorTime desc',
            viewrecords: true
        });
        $("#btn_search").click(function () {
            debugger;
            $gridList.jqGrid('setGridParam', {
                postData: { keyword: $("#txt_keyword").val() },
            }).trigger('reloadGrid');
        });
    }
    function btn_add() {
        $.modalOpen({
            id: "Form",
            title: "添加操作指南",
            url: "/Project/Instructions/Form",
            width: "1000px",
            height: "600px",
            callBack: function (iframeId) {
                top.frames[iframeId].submitForm();
            }
        });
    }
    function btn_edit() {
        var keyValue = $("#gridList").jqGridRowValue().F_Id;
        $.modalOpen({
            id: "Form",
            title: "修改操作指南",
            url: "/Project/Instructions/Form?keyValue=" + keyValue,
            width: "1000px",
            height: "600px",
            callBack: function (iframeId) {
                top.frames[iframeId].submitForm();
            }
        });
    }

    function btn_details() {
        var keyValue = $("#gridList").jqGridRowValue().F_Id;
        $.modalOpen({
            id: "Details",
            title: "查看操作指南",
            url: "/Project/Instructions/Details?keyValue=" + keyValue,
            width: "1000px",
            height: "600px",
            btn: null,
        });
    }

</script>




<div class="topPanel">
    <div class="toolbar">
        <div class="btn-group">
            <a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
        </div>
        <div class="btn-group">
            <a id="NF-add" class="btn btn-primary dropdown-text" onclick="btn_add()"><i class="fa fa-plus"></i>新增操作指南</a>
        </div>
        <div class="operate">
            <ul class="nav nav-pills">
                <li class="first">已选中<span>1</span>项</li>
                <li><a id="NF-edit" onclick="btn_edit()"><i class="fa fa-pencil-square-o"></i>修改操作指南</a></li>
                <li><a id="NF-Details" onclick="btn_details()"><i class="fa fa-search-plus"></i>查看操作指南</a></li>
                <li class="split"></li>
            </ul>
            <a href="javascript:;" class="close"></a>
        </div>
        <script>$('.toolbar').authorizeButton()</script>
    </div>
    <div class="search">
        <table>
           <tr>
                    @*<td>
                        <div class="input-group" style="padding-left:11px;padding-right:10px;">
                            <input id="txt_keyword" type="text" class="form-control" placeholder="按照标题模糊搜索" style="width: 200px;">
                            <span class="input-group-btn">
                                <button id="btn_search" type="button" class="btn  btn-primary active"><i class="fa fa-search"></i></button>
                            </span>
                        </div>
                    </td>*@
                </tr>
        </table>
    </div>
</div>
<style>
    table tr td {
        padding-left: 15px;
    }
</style>
<div class="gridPanel">
    <table id="gridList"></table>
    <div id="gridPager"></div>
</div>
